﻿using Cl.Entity.DataBaseEntity.User;
using Cl.Model.DataBaseEntityDtos.User.Departments;
using Cl.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cl.Service.Service.User.Departments
{
    public class DepartmentService : ClRepository<Department>, IDepartmentService
    {
        private ClRepository<Department> _departmentRepository;
        public DepartmentService(ClRepository<Department> departmentRepository)
        {
            _departmentRepository = departmentRepository;
        }

        public List<DepartmentOutDto> GetDepartmentList()
        {
            return _departmentRepository.AsQueryable()
                .Where(x => x.Enabled == true)
                .Select(x => new DepartmentOutDto(x) { }).ToList();
        }
    }
}
